package top.leix.springdemo.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import top.leix.springdemo.DTO.LoginRequest;
import top.leix.springdemo.Res;
import top.leix.springdemo.services.CommonService;
import top.leix.springdemo.services.LabService;
import top.leix.springdemo.services.impl.LoginService;

import javax.annotation.Resource;

@CrossOrigin
@Slf4j
@Tag(name = "登录接口")
@RestController
@RequestMapping("/login")
public class LoginController {


    @Resource
    LoginService loginService;
    /**
     * 登录接口
     */
    @PostMapping("/admin")
    public Res admin(String userAccount, String userPassword) {
        return loginService.loginAdmin(userAccount,userPassword);
    }

    @PostMapping("/teacher")
    public Res teacher(String userAccount, String userPassword) {
        return loginService.loginTeacher(userAccount,userPassword);
    }
    @PostMapping("/student")
    public Res student(@RequestBody LoginRequest loginRequest) {
        return loginService.loginStudent(loginRequest.getUserAccount(),loginRequest.getUserPassword());
    }
    @PostMapping("/labAssistant")
    public Res labAssistant(String userAccount, String userPassword) {
        return loginService.loginLabAssistant(userAccount,userPassword);
    }

}
